﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Runtime.Serialization;
using System.Web;

namespace KPIS.GERP.WCF.ePayment.Models
{
    [DataContract, Table("Announce")]
    public class Announce
    {
        public Announce()
        {
            //deleted = false;
            //this.AnnounceItems = new HashSet<AnnounceItem>();
        }

        [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        [DataMember, Display(Name = "invoice_id")]
        public int announce_id { get; set; }

        [DataMember, Display(Name = "เลขที่ประกาศ")]
        [MaxLength(25)]
        [Required]
        public string announce_code { get; set; }

        [DataMember, Display(Name = "เลขประจำตัวผู้เสียภาษี")]
        [MaxLength(15)]
        public string supplier_tax_code { get; set; }

        [DataMember, Display(Name = "เลขสาขา 5 หลัก")]
        [MaxLength(15)]
        public string supplier_branch_code { get; set; }

        [DataMember, Display(Name = "วันที่ประกาศ")]
        public DateTime announce_date { get; set; }

        [DataMember, Display(Name = "รหัสหน่วยงานราชการ")]
        [MaxLength(20)]
        public DateTime g_office_code { get; set; }

        [DataMember, Display(Name = "ชื่อหน่วยงานราชการ")]
        [MaxLength(120)]
        public string g_office_name { get; set; }

        [DataMember, Display(Name = "หมายเหตุ")]
        [MaxLength(2000)]
        public string remark { get; set; }

        [DataMember, Display(Name = "หมายเหตุ")]
        [MaxLength(2000)]
        public string contact_code { get; set; }

        [DataMember, Display(Name = "หมายเหตุ")]
        [MaxLength(2000)]
        public string contact_name { get; set; }

        public ICollection<AnnounceItem> items { get; set; }
    }

    [DataContract, Table("AnnounceItem")]
    public class AnnounceItem
    {
        public string product_code { get; set; }
        public string product_name { get; set; }
        public string qty { get; set; }
        public string price { get; set; }
        public string exclude_vat_amount { get; set; }
        public string discount_amount { get; set; }
        public string unit { get; set; }
        public string remark_1 { get; set; }
        public string doc_id { get; set; }
    }

    public class SendAnnounce
    {
        public string announce_code { set; get; }
        public string supplier_tax_code { set; get; }
        public string supplier_branch_code { set; get; }
        public string announce_date { set; get; }
        public string g_office_code { set; get; }
        public string g_office_name { set; get; }
        public string remark { set; get; }
        public string contact_code { set; get; }
        public string contact_name { set; get; }
        public string project_code { set; get; }
        public string project_name { set; get; }
        public string valid_date { set; get; }
        public string delivery_date { set; get; }
        public string telephone { set; get; }
        public string doc_id { set; get; }
        public List<SendAnnounceItem> item { set; get; }
    }

    public class SendAnnounceItem
    {
        public string product_code { set; get; }
        public string product_name { set; get; }
        public string quantity { set; get; }
        public string price { set; get; }
        public string amount { set; get; }
        public string unit { set; get; }
        public string remark { set; get; }
        public string doc_id { set; get; }
    }
}